import { useEffect } from "react"
import Header from "./components/header"
import Main from "./components/main"

import { get } from "@/api/index"
import "./index.less"
export default function Home(){
  useEffect(()=>{
    async function getUserInfo(){
      const { id } = JSON.parse(sessionStorage.getItem("userInfo") as string)
      const res = await get(`/users/getUserInfo?id=${id}`)
      if(res.code === 200 && res.data){
        sessionStorage.setItem("userDetail",JSON.stringify(res.data))
      }
    }
    getUserInfo()
  },[])
  return (
    <div className="home-contain">
      <Header/>
      <Main/>
    </div>
  )
}